<template>
    <view class="item">
        <view class="flex justify_content_between f_28 mb_24">
            <view class="flex">
                <image class="storeImg" :src="$lz.cdn('imgs/img.png', 1)" mode=""></image>
                <text>{{item.store_name}}</text>
                <u-icon name="arrow-right" size="16"></u-icon>
            </view>
            <view class="cl_3377FF fw_bold">{{item.order_text}}</view>
        </view>
        <view class="flex" v-for="goods in item.specifications">
            <view>
                <image class="shopImg" :src="goods.product_image" mode="widthFix"></image>
            </view>
            <view>
                <view class="fw_bold f_32 listTitle">{{ goods.title}}</view>
                <view class="flex justify_content_between">
                    <view class="cl_999CA3 mr_24 f_28">{{ goods.guige }}</view>
                    <view class="cl_999CA3 mr_24 f_28">x{{ goods.num }}</view>
                </view>
                <view class="flex justify_content_end mt_40 f_28">￥{{ goods.money }}</view>
            </view>
        </view>

        <view class="flex justify_content_between f_28 mt_16">
            <view class="cl_CCCED1">{{ item.createtime }}</view>
            <view class="flex">
                <view class="cl_666B75">共{{ item.specifications.length }}件 合计</view>
                <view class="flex justify_content_end cl_FF6401 f_32 fw_bold">￥{{ item.actual_price }}</view>
            </view>
        </view>
        <view class="flex justify_content_end mt_16">
			<view class="flex btn" @click="q_order(item.id)" v-if="item.order_status==0">取消订单</view>
			<view class="flex btn" @click="y_q_order(item.id)" v-if="item.order_status==1&&item.rider_status==1">取消订单</view>
			<view class="flex btn" @click="details(item.id,1)" v-if="item.order_status==0">立即付款</view>
			<view class="flex btn" @click="evaluate(item.id)" v-if="item.order_status==1&&item.rider_status==4&&item.is_p==0">去评价</view>
			<view class="flex btn" @click="user_wc(item.id)" v-if="item.rider_status==1||item.rider_status==2||item.rider_status==3">确认收货</view>
           <!-- <view v-if="![4, 5, 6].includes(item.status)" class="flex btn">
                <view>取消订单</view>
            </view> -->
            <!-- 待支付 -->
           <!-- <view class="flex btn back_3377FF cl_fff" @click.stop="buy">
                <view>立即付款</view>
            </view> -->
            <!-- 待发货 -->
            <!-- <view v-if="item.status == 3" class="flex btn back_3377FF cl_fff" @click.stop="orderInfo">
                <view>订单详情</view>
            </view> -->
            <!-- 带收货 -->
            <!-- <view v-if="item.status == 4" class="flex btn" @click.stop="loginst">
                <view>查看物流</view>
            </view>
            <view v-if="item.status == 4" class="flex btn back_3377FF cl_fff">
                <view>确认收货</view>
            </view> -->
            <!-- 完成 -->
            <!-- <view v-if="item.status == 5" class="flex btn">
                <view>删除订单</view>
            </view>
            <view v-if="item.status == 5" class="flex btn back_3377FF cl_fff" @click.stop="evaluea">
                <view>去评价</view>
            </view> -->
            <!-- 售后 -->
            <!-- <view v-if="item.status == 6" class="flex btn">
                <view>删除售后</view>
            </view>
            <view v-if="item.status == 6" class="flex btn back_3377FF cl_fff" @click.stop="details1">
                <view>售后详情</view>
            </view> -->
        </view>
    </view>
</template>
<script>
export default {
    name: 'order-item-goods',
    props: {
        item: {
            type: Object,
            default: () => {}
        }
    },
    data() {
        return {
            sendShow: false,
            type: 0, //0待发货，1待收货，2已完成，3售后中
            ProductType: 1, //0普通商品，1电池
            tipIndex: 3,
            tabIndex: 1,
            value1: 0
        };
    },
    methods: {
        sendClose() {
            this.sendShow = false;
        },
		//未支付取消
		q_order(id){
			this.$.ajax(1, "POST", "users/q_order", {
					id:id,
				}, (res) => {
					if(res.code==200){
						this.$.ti_shi(res.msg)
						 setTimeout(()=>{
							 this.$emit('handleGetOrderList')
						 },1000)
						 
					}else{
						this.$.ti_shi(res.msg)
					}
				})
		},
		user_wc(id){
			this.$.ajax(1, "POST", "users/user_wc", {
					order_id:id,
				}, (res) => {
					if(res.code==200){
						this.$.ti_shi(res.msg)
						 setTimeout(()=>{
							 this.$emit('handleGetOrderList')
						 },1000)
						 
					}else{
						this.$.ti_shi(res.msg)
					}
				})
		},
		buybtn(id,t) {
		    uni.navigateTo({
		        url: '/pages/me/MyOrder/LogisticsInformation?id=' + id+'&t='+t
		    });
		},
		//已支付取消
		y_q_order(id){
			uni.navigateTo({
			    url: '/pages/me/MyOrder/CarCancels?id=' + id
			});
		},
        // 待发货详情
        details(type) {
            console.log(1);
            // if (this.ProductType == 0) {
                uni.navigateTo({
                    url: '/pages/me/MyOrder/MallToBePaid?id='+ type
                });
            // }
            // if (this.ProductType == 1) {
            //     uni.navigateTo({
            //         url: '/pages/me/MyOrder/BatteryCompleted'
            //     });
            // }
        },
        // 售后详情
        details1() {
            uni.navigateTo({
                url: '/pages/business/AfterSales'
            });
        },
        // 查看评价
        evaluate(id) {
            uni.navigateTo({
                url: '/pages/me/MyOrder/evaluates?id=' + id
            });
        },
        // 查看物流
        loginst() {
            console.log(1);
            uni.navigateTo({
                url: '/pages/business/LogisticsInformation'
            });
        },
        add() {
            uni.navigateTo({
                url: '/pages/business/addProduct'
            });
        },
        add_zc() {
            uni.navigateTo({
                url: '/pages/business/CarRental'
            });
        }
    }
};
</script>

<style scoped lang="scss">
.item {
    padding: 24rpx 0;
}
.nameTitle {
    text-align: center;
}
.storeImg {
    width: 48rpx;
    height: 48rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    margin-right: 8rpx;
}
.name {
    width: 574rpx;
    height: 92rpx;
    line-height: 92rpx;
    padding: 0 24rpx;
    margin-top: 10px;
}

.nameBtn {
    width: 298rpx;
    height: 100rpx;
    line-height: 100rpx;
    text-align: center;
    display: inline-block;
    margin-top: 64rpx;
}
.userInfo {
    background: #f7f7f7;
    border-radius: 16rpx;
    font-size: 28rpx;
    padding: 8rpx 24rpx;
    margin-top: 26rpx;
    .info {
        padding: 8rpx 0;
    }
}
.listTitle {
    width: 400rpx;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list {
    background: white;
    border-radius: 24rpx;
    margin-top: 24rpx;
    padding: 24rpx;
    display: block;
    overflow: hidden;
}
.shopImg {
    width: 200rpx;
    height: 200rpx;
    border-radius: 16rpx;
    margin-right: 24rpx;
}
.tipbox {
    background: #f7f7f7;
    border-radius: 8rpx;
    color: #666b75;
    font-size: 28rpx;
    padding: 8rpx;
}
.tip {
    padding: 16rpx;
    border-radius: 8rpx;
}
.tipActive {
    background: white;
    color: #00091a;
    padding: 16rpx;
    border-radius: 8rpx;
}
.tab {
    color: #999ca3;
    font-size: 28rpx;
    margin: 19rpx;
}
.tabActive {
    color: #3377ff;
    font-size: 32rpx;
    margin: 19rpx;
    font-weight: bold;
}
.btn {
    height: 68rpx;
    line-height: 68rpx;
    padding: 0 30rpx;
    text-align: center;
    border: 2rpx solid #ccced1;
    border-radius: 16rpx;
    margin: 0 12rpx;
    font-size: 28rpx;
}
</style>
